package ast;

import ir.*;

public class IfNode extends StmtNode {
	    private ExprNode cond;
	    private StmtNode thenBody;
	    private StmtNode elseBody;
	    private CJump ir;
	    public IfNode(Location loc, ExprNode c, StmtNode t, StmtNode e) {
	        super(loc);
	        this.cond = c;
	        this.thenBody = t;
	        this.elseBody = e;
	    }

	    public ExprNode cond() {
	        return cond;
	    }

	    public StmtNode thenBody() {
	        return thenBody;
	    }

	    public StmtNode elseBody() {
	        return elseBody;
	    }
	    public void setIR(CJump ir){
	    	this.ir=ir;
	    }
	    protected void printTree(Dumper d) {
	        d.printMember("cond", cond);
	        d.printMember("thenBody", thenBody);
	        d.printMember("elseBody", elseBody);
	    }
	    public<S,E> S  accept(ASTVisitor<S, E> visitor){
	    	return visitor.visit(this);
	    }
}
